package com.pascal91.webpp.service;

import com.pascal91.webpp.dao.UsersDao;
import com.pascal91.webpp.model.Users;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;

import java.util.List;

@Service
public class UsersServiceImpl implements UsersService {

    @Autowired
    UsersDao usersDao;

    @Override
    @Transactional
    public List<Users> getUsersList() {
        return usersDao.getUsersList();
    }

    @Override
    @Transactional
    public void addUser(Users user) {
        usersDao.addUser(user);
    }

    @Override
    @Transactional
    public void deleteUserByID(Long id) {
        usersDao.deleteUserByID(id);
    }

    @Override
    @Transactional
    public Users findUserByLogin(String login){
        return (Users) usersDao.findUserByLogin(login);
    }

}
